$.changCount = function(th){
	nowCount=th.value;
	$("#tableInfo tr:gt(0)").remove();
	if(nowCount>sumCount)
	nowCount = nowCount-nowCount%sumCount;
	for(i=0;i<nowCount;i++)
		$.appendTip(i);
	nowMin=1;
	nowMax=i;
	nowPage=1;
	$("#sumCount").html(sumCount);
	if(sumCount%nowCount==0)
		sumPage=sumCount/nowCount;
	else
		sumPage=Math.floor(sumCount/nowCount)+1;
	$.InitValue(1,nowMax);
	$.checkPagesnum();
}
$.checkPagesnum = function(){
	if(nowPage<=1){
		$("#fipage").css('cursor','auto');
		$("#fipage").css('color','#999');
		$("#fopage").css('cursor','auto');
		$("#fopage").css('color','#999');
		nowPage=1;
	}
	else{
		$("#fipage").css('cursor','pointer');
		$("#fipage").css('color','#66B3FF');
		$("#fopage").css('cursor','pointer');
		$("#fopage").css('color','#66B3FF');
	}
	if(nowPage >= sumPage){
		$("#nepage").css('cursor','auto');
		$("#nepage").css('color','#999');
		$("#lapage").css('cursor','auto');
		$("#lapage").css('color','#999');
		nowPage=sumPage;
	}
	else{
		$("#nepage").css('cursor','pointer');
		$("#nepage").css('color','#66B3FF');
		$("#lapage").css('cursor','pointer');
		$("#lapage").css('color','#66B3FF');
	}
}
$.nextPage = function(){
	if(nowPage < sumPage){
		$("#tableInfo tr:gt(0)").remove();
		 for(i=nowMax;i<nowMax*1+nowCount*1;i++){
			if(i>sumCount-1)
				break;
			else
				$.appendTip(i);
		}
		nowMin=nowMax;
		nowMax=i;
		nowPage++;
		$.InitValue(nowMin+1,nowMax);
	}
	$.checkPagesnum();
}

$.formPage = function(){
	if(nowPage>1){
		$("#tableInfo tr:gt(0)").remove();
		 for(i=nowMin-nowCount;i<nowMin;i++){
			 $.appendTip(i);
		}
		nowMin=nowMin-nowCount;
		nowMax=i;
		nowPage--;
		$.InitValue(nowMin+1,nowMax);
	}
	$.checkPagesnum();
}
$.firstPage = function(){
	$("#tableInfo tr:gt(0)").remove();
	for(i=0;i<nowCount;i++){
		$.appendTip(i);
	}
	nowMin=1;
	nowMax=i;
	nowPage=1;
	$.InitValue(1,nowMax);
	$.checkPagesnum();
}
$.lastPage = function(){
	$("#tableInfo tr:gt(0)").remove();
	if(sumCount%nowCount==0){
		for(i=sumCount-nowCount;i<sumCount;i++){
			$.appendTip(i);
		}
		nowMin=sumCount-nowCount;
	}else{
		for(i=sumCount-(sumCount%nowCount);i<sumCount;i++){
			$.appendTip(i);		
		}
		nowMin=sumCount-(sumCount%nowCount);
	}
	nowMax=sumCount;
	nowPage=sumPage;
	$.InitValue(nowMin+1,nowMax);
	$.checkPagesnum();
}
$.InitValue = function(min,max){
	$("#firtLine").html(min);
	$("#lastLine").html(max);
	$("#nopage").html(nowPage);
	$("#alpage").html(sumPage);
}